<div id="phtmlcont" style="display:none;"></div>
<textarea id="content" name="content" style="width:698px;height:305px;margin-top:8px;"></textarea>
<!--编辑器-->
<script>
$(document).ready(function(){
	$('#content').val(sessionStorage.lihtml);
})

function childFunction(){
	var content = $('#phtmlcont').html();
	return content;
}

var editor;
KindEditor.ready(function(K) {
	editor = K.create('#content', {
		themeType : 'qq',
                pasteType : 1,
//		items : [
//			'bold','italic','underline','fontname','fontsize','forecolor','hilitecolor','plug-align','plug-indent','link'
//		],
		items : [],
		afterChange:function(){//内容发生变化时，就更改#phtmlcont的HTML
			K("#phtmlcont").html("");
			K("#phtmlcont").html(this.html());
		}
	});
	K.each({
		'plug-align' : {
			name : '对齐方式',
			method : {
				'justifyleft' : '左对齐',
				'justifycenter' : '居中对齐',
				'justifyright' : '右对齐'
			}
		},
		'plug-indent' : {
			name : '缩进',
			method : {
				'indent' : '向右缩进',
				'outdent' : '向左缩进'
			}
		}
	},function( pluginName, pluginData ){
		var lang = {};
		lang[pluginName] = pluginData.name;
		KindEditor.lang( lang );
		KindEditor.plugin( pluginName, function(K) {
			var self = this;
			self.clickToolbar( pluginName, function() {
				var menu = self.createMenu({
						name : pluginName,
						width : pluginData.width || 100
					});
				K.each( pluginData.method, function( i, v ){
					menu.addItem({
						title : v,
						checked : false,
						iconClass : pluginName+'-'+i,
						click : function() {
							self.exec(i).hideMenu();
						}
					});
				})
			});
		});
	});
});
</script>